<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			// let arr = [1, 2, 3, 5];
			// arr.map((item, index)=>{
			// 	if(item==1){
			// 		return alert(11)
			// 	}
			// })
			let objArr = [
				{
					'msg':'sdfsdf',
					'text' : 'sdafasfdasdf'
				},
				{
					'msg':'sdfsdf',
					'text' : 'sdafasfdasdf'
				},
				{
					'msg'  : 'hello',
					'text' : 'world' 
				},
				{
					'msg'  : 'js',
					'text' : 'c++'
				}
			]
			function uniqObjInArray(objarray){
				let len = objarray.length;
				let tempJson = {
					
				};
				let res = [];
				for(let i = 0;i < len;i++){
					//取出每一个对象
					tempJson[JSON.stringify(objarray[i])] = true;
				}
				console.log("tempJson is ",tempJson);
				let keyItems= Object.keys(tempJson);
				for(let j = 0;j < keyItems.length;j++){
					res.push(JSON.parse(keyItems[j]));
				}
				return res;
			}
			let res3 = uniqObjInArray(objArr);
			console.log("res3 is ",res3);
			
		</script>
	</body>
</html>
